package com.jcnet.bizaia.json;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

public class JSONPare {


	public static void getDefaultJson(String jsonString){
		JSONTokener jsonTokener = new JSONTokener(jsonString);
		try {
			JSONObject jsonObject = (JSONObject)jsonTokener.nextValue();

			jsonObject.getInt("state");
			jsonObject.getString("message");

			JSONArray jsonArray =   jsonObject.getJSONArray("objlistJson");
			JSONObject jsonObc = jsonArray.getJSONObject(0);

/*			DiscussBean sBean = new DiscussBean(
					jsonObc.getInt("crid"), jsonObc.getString("title"),
					jsonObc.getString("describing"), jsonObc.getString("holddate"),  jsonObc.getString("craddress"),
					jsonObc.getLong("lng"), jsonObc.getLong("lat"), jsonObc.getString("crtel"), 
					jsonObc.getString("begindate"), jsonObc.getString("enddate"), jsonObc.getInt("crnumber"));*/
			
			System.out.println(jsonObc.getInt("crid"));
			System.out.println( jsonObc.getString("title"));


		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


	class DiscussBean{
		private int crid;
		private String title;
		private String describing;
		private String holddate;
		private String craddress;
		private long lng;
		private long lat;
		private String crtel;
		private String begindate;
		private String enddate;
		private int crnumber;
		public int getCrid() {
			return crid;
		}
		public void setCrid(int crid) {
			this.crid = crid;
		}
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public String getDescribing() {
			return describing;
		}
		public void setDescribing(String describing) {
			this.describing = describing;
		}
		public String getHolddate() {
			return holddate;
		}
		public void setHolddate(String holddate) {
			this.holddate = holddate;
		}
		public String getCraddress() {
			return craddress;
		}
		public void setCraddress(String craddress) {
			this.craddress = craddress;
		}
		public long getLng() {
			return lng;
		}
		public void setLng(long lng) {
			this.lng = lng;
		}
		public long getLat() {
			return lat;
		}
		public void setLat(long lat) {
			this.lat = lat;
		}
		public String getCrtel() {
			return crtel;
		}
		public void setCrtel(String crtel) {
			this.crtel = crtel;
		}
		public String getBegindate() {
			return begindate;
		}
		public void setBegindate(String begindate) {
			this.begindate = begindate;
		}
		public String getEnddate() {
			return enddate;
		}
		public void setEnddate(String enddate) {
			this.enddate = enddate;
		}
		public int getCrnumber() {
			return crnumber;
		}
		public void setCrnumber(int crnumber) {
			this.crnumber = crnumber;
		}
		@Override
		public String toString() {
			// TODO Auto-generated method stub
			return title+enddate+begindate+enddate+holddate;
		}
		public DiscussBean(int crid, String title, String describing,
				String holddate, String craddress, long lng, long lat,
				String crtel, String begindate, String enddate, int crnumber) {
			super();
			this.crid = crid;
			this.title = title;
			this.describing = describing;
			this.holddate = holddate;
			this.craddress = craddress;
			this.lng = lng;
			this.lat = lat;
			this.crtel = crtel;
			this.begindate = begindate;
			this.enddate = enddate;
			this.crnumber = crnumber;
		}



	}
}
